package days25.title125;

import org.junit.Test;

/**
 * @Author fengzihao
 * @Date 2024-05-09 20:40
 */
class Solution {
    // @Test
    // public void test(){
    //     System.out.println("isPalindrome(\"0P\") = " + isPalindrome("0P"));
    // }
    public boolean isPalindrome(String s) {
        String str = "";
        for (int i = 0; i < s.length(); i++) {
            if (Character.isLetter(s.charAt(i))||Character.isDigit(s.charAt(i)))
                str = str + s.charAt(i);
        }
        if ("".equals(str))
            return true;
        str = str.toLowerCase();
        String str1 = new StringBuffer(str).reverse().toString();
        return str.equals(str1);
    }
}